/**
 * 菜单管理相关API
 */
import request from '@/utils/request'

const api_base = '/sys-menu'

export default {
  getAllNodes() {
    return request({
      url: `${api_base}`,
      method: 'get'
    })
  },
  removeById(id) {
    return request(({
      url: `${api_base}/${id}`,
      method: 'delete'
    }))
  },
  save(data) {
    return request({
      url: `${api_base}`,
      method: 'post',
      data: data
    })
  },
  // 编辑角色
  getById(id) {
    return request({
      url: `${api_base}/${id}`,
      method: 'get'
    })
  },
  update(data) {
    return request({
      url: `${api_base}`,
      method: 'put',
      data: data
    })
  },
  updateStatus(id, status) {
    return request({
      url: `${api_base}/${id}/${status}`,
      method: 'put'
    })
  },
  // 批量删除角色
  removeBatch(ids) {
    return request({
      url: `${api_base}/batch`,
      method: `delete`,
      data: ids
    })
  },
  getMenuByRoleId(roleId) {
    return request({
      url: `${api_base}/assion/${roleId}`,
      method: 'get'
    })
  },
  doAssign(assignMenuVo) {
    return request({
      url: `${api_base}/doAssign`,
      method: 'post',
      data: assignMenuVo
    })
  }
}
